/*
 * OPIAM Suite
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */

package opiam.admin.faare.service.services.views;

import opiam.admin.faare.config.javabeans.JBViewDef;
import opiam.admin.faare.service.UserContext;

import java.util.List;


/**
 * Generation interface of the views.
 * All the plugins must implement this interface.
 * Two plugins are delivered by default : LogicalTreeView and PhysicalTreeView.
 *
 */
public interface TreeView
{
    /**
     * Returns the view definition.
     *
     * @return The JBViewDef object.
     */
    JBViewDef getJBViewDef();

    /**
     * Sets the viewDef.
     *
     * @param jbViewDef  The jbViewDef to set.
     */
    void setJBViewDef(JBViewDef jbViewDef);

    /**
     * Returns the basic node of the view.
     *
     * @return The JBTreeNode object.
     */
    JBTreeNode getRoot();

    /**
     * Returns the children JBTop objects list of the JBTreeNode.
     *
     * @param node   Node on which the children JBTop objects will be created.
     * @param level  View level on which we are.
     *
     * @return List of JBTop objects.
     */
    List getChildrenByJBTreeNode(JBTreeNode node, int level);

    /**
     * Sets the user context.
     * This method allows to link the view to the user context.
     *
     * @param userContext  Context of the user.
     */
    void setUserContext(UserContext userContext);
}
